package com.photohistory.hibernate.beans;
// Generated 31.03.2010 12:15:52 by Hibernate Tools 3.2.4.GA


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Photo generated by hbm2java
 */
@Entity
@Table(name="photo"
    ,catalog="mytest"
)
public class Photo  implements java.io.Serializable {


     private Integer id;
     private User user;
     private String name;
     private Date dateOfTake;
     private Date dateOfUpload;
     private String url;
     private Date hourOfTake;
     private String description;
     private Set<Photohascategory> photohascategories = new HashSet<Photohascategory>(0);
     private Set<Rating> ratings = new HashSet<Rating>(0);
     private NaturalPhoto naturalPhoto;
     private Set<Comment> comments = new HashSet<Comment>(0);

    public Photo() {
    }

	
    public Photo(User user, String name, Date dateOfTake, String url) {
        this.user = user;
        this.name = name;
        this.dateOfTake = dateOfTake;
        this.url = url;
    }
    public Photo(User user, String name, Date dateOfTake, Date dateOfUpload, String url, Date hourOfTake, String description, Set<Photohascategory> photohascategories, Set<Rating> ratings, NaturalPhoto naturalPhoto, Set<Comment> comments) {
       this.user = user;
       this.name = name;
       this.dateOfTake = dateOfTake;
       this.dateOfUpload = dateOfUpload;
       this.url = url;
       this.hourOfTake = hourOfTake;
       this.description = description;
       this.photohascategories = photohascategories;
       this.ratings = ratings;
       this.naturalPhoto = naturalPhoto;
       this.comments = comments;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)

    
    @Column(name="id", unique=true, nullable=false)
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="user_id", nullable=false)
    public User getUser() {
        return this.user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }

    
    @Column(name="name", nullable=false, length=50)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

    @Temporal(TemporalType.DATE)
    @Column(name="date_of_take", nullable=false, length=10)
    public Date getDateOfTake() {
        return this.dateOfTake;
    }
    
    public void setDateOfTake(Date dateOfTake) {
        this.dateOfTake = dateOfTake;
    }

    @Temporal(TemporalType.DATE)
    @Column(name="date_of_upload", length=10)
    public Date getDateOfUpload() {
        return this.dateOfUpload;
    }
    
    public void setDateOfUpload(Date dateOfUpload) {
        this.dateOfUpload = dateOfUpload;
    }

    
    @Column(name="url", nullable=false, length=1000)
    public String getUrl() {
        return this.url;
    }
    
    public void setUrl(String url) {
        this.url = url;
    }

    @Temporal(TemporalType.TIME)
    @Column(name="hour_of_take", length=8)
    public Date getHourOfTake() {
        return this.hourOfTake;
    }
    
    public void setHourOfTake(Date hourOfTake) {
        this.hourOfTake = hourOfTake;
    }

    
    @Column(name="description", length=65535)
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="photo")
    public Set<Photohascategory> getPhotohascategories() {
        return this.photohascategories;
    }
    
    public void setPhotohascategories(Set<Photohascategory> photohascategories) {
        this.photohascategories = photohascategories;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="photo")
    public Set<Rating> getRatings() {
        return this.ratings;
    }
    
    public void setRatings(Set<Rating> ratings) {
        this.ratings = ratings;
    }

@OneToOne(fetch=FetchType.LAZY, mappedBy="photo")
    public NaturalPhoto getNaturalPhoto() {
        return this.naturalPhoto;
    }
    
    public void setNaturalPhoto(NaturalPhoto naturalPhoto) {
        this.naturalPhoto = naturalPhoto;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="photo")
    public Set<Comment> getComments() {
        return this.comments;
    }
    
    public void setComments(Set<Comment> comments) {
        this.comments = comments;
    }

    public String toString(){
    	return name;
    }


}


